package com.yoso.controller;

import com.yoso.domain.User;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


/**
 * @author shizejin
 * @date 2021/10/26
 * @description:
 */
@RestController
public class ParamController {
    @GetMapping("/hello")
    public String hello(){
        return "hello";
    }
    @PostMapping("/printUser")
    public User getUser(@RequestBody User user){
        System.out.println(user);
        return user;
    }
    @PostMapping("/printMsgAndUser")
    public User getUser(String msg, @RequestBody User user){
        System.out.println(user);
        System.out.println(msg);
        return user;
    }

    @PostMapping("/get")
    public User getUser(@RequestBody List<User> user){
        for (User user1 : user) {
            System.out.println(user1);
        }
        return null;
    }
}
